www.gusucode.com > 循环自相关函数工具箱源码程序 > matlab代做 修改 程序循环自相关函数工具箱/cyclostationary_toolbox/get_impulses.m

    function [p,m,md,s]=get_impulses(ts,threshold,max_std)
%
% GET_IMPULSES
%                   get impulses from a noisy series of pulses
%                   
% USAGE 
%                   [p,m,md,s]=get_impulses(x,threshold,max_deviation)
%                 
%                   Detects pulses p as a change in the signal > threshold
%                   Changes closer than max_deviation percent of the 
%                   median pulse difference are discarded.
%
%                   Provides mean(m), median (md) and standard deviation(s)
%                   of times between pulses

% File: get_impulses.m
% Last Revised: 25/11/97
% Created: 25/11/97
% Author: Andrew C. McCormick
% (C) University of Strathclyde


d=diff(ts);

p=find(d>threshold);

md=median(diff(p));
x=find(diff(p)>md-(max_std*md/100));
p=p(x);
md=median(diff(p));
x=find(diff(p)<md+(max_std*md/100));
p=p(x);

dp=diff(p);
x=find(dp<md+(max_std*md/100));
md=median(dp(x));
m=mean(dp(x));
s=std(dp(x));